import request from "@/utils/request";

// 查询消息通知列表
export function listMessage(query) {
  return request({
    url: "/system/message/list",
    method: "get",
    params: query,
  });
}

// 查询消息通知详细
export function getMessage(messageId) {
  return request({
    url: "/system/message/" + messageId,
    method: "get",
  });
}

// 新增消息通知
export function addMessage(data) {
  return request({
    url: "/system/message",
    method: "post",
    data: data,
  });
}

// 修改消息通知
export function updateMessage(data) {
  return request({
    url: "/system/message",
    method: "put",
    data: data,
  });
}

// 删除消息通知
export function delMessage(messageId) {
  return request({
    url: "/system/message/" + messageId,
    method: "delete",
  });
}

// 标记消息为已读
export function markAsRead(messageId) {
  return request({
    url: "/system/message/read/" + messageId,
    method: "put",
  });
}

// 获取未读消息数量
export function getUnreadCount() {
  return request({
    url: "/system/message/unread/count",
    method: "get",
  });
}
